<template>
	<div class="m_r">
		<header class="top_bar">
			<a onclick="window.history.go(-1)" class="icon_back"></a>
			<h3 class="cartname">找回密码</h3>
		</header>
		<main class="user_login_box">
			<div class="login_dialog">
				<div class="_username">
					<input type="text" name="regname" placeholder="用户名/邮箱/手机号" class="user_input" v-model="regname">
				</div>
				<div class="_username u_passwd">
					<input type="password" name="regpasswd" placeholder="请输入密码" class="user_input" v-model="regpasswd">
				</div>
				<div class="_username u_passwd">
					<input type="password" name="regpasswd_ag" placeholder="请再次输入密码" class="user_input" v-model="regpasswd_ag">
				</div>
				<div class="login_box">
					<a @click="goSearch()" class="btn_login">找回密码</a>
				</div>
			</div>
		</main>
	</div>
</template>
<script>
	import { Toast } from 'mint-ui';
	export default {
		data() {
			return {
				regname: '',
				regpasswd: '',
				regpasswd_ag: '',
				regInfo: {}
			}
		},
		methods: {
			goSearch() {
				let _this = this;
				_this.$http.post('/base/signUp', {
					CellPhone: _this.regname,
					Password: _this.regpasswd,
					code: 111
				}, localStorage.Authorization, res => {
					console.log('注册返回res', res)
					if(res.code === 200) {
						Toast(res.data);
						setTimeout(function() {
							_this.$router.push({
								path: '/login'
							});
						}, 1500)

					}else if(res.code === 101) {
						localStorage.fromPath = _this.$route.fullPath
						_this.$router.push({
							path: '/login'
						})
					} else {
						Toast(res.error);

					}
				})
			}
		}
	}
</script>
<style>
	@import '../assets/css/reg.css';
</style>